package com.tenghu.core.service.impl;


import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.tenghu.core.dao.IEmpDao;
import com.tenghu.core.model.Emp;
import com.tenghu.core.service.IEmpService;
@Service
@Transactional
public class EmpServiceImpl implements IEmpService{
	@Autowired
	private IEmpDao empBiz;

	public String saveEmp(Emp emp) {
		try {
			empBiz.saveEmp(emp);
			return "添加成功";
		} catch (Exception e) {
			e.printStackTrace();
		}
		return "添加失败";
	}

	public List<Emp> queryEmpList() {
		return empBiz.queryEmpList();
	}

	public String updateEmp(Emp emp) {
		try {
			empBiz.updateEmp(emp);
			return "修改成功";
		} catch (Exception e) {
			e.printStackTrace();
		}
		return "修改失败";
	}

	public Emp queryEmpByName(String name) {
		return empBiz.queryEmpByName(name);
	}

	public String deleteEmp(Emp emp) {
		try {
			empBiz.deleteEmp(emp);
			return "删除成功";
		} catch (Exception e) {
			e.printStackTrace();
		}
		return "删除失败";
	}

}
